unit AnimParts;

interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
  Forms, Dialogs, Supply, Vectors2, AsphyreDef;

type
TAnimPart=record
  Point:TPoint2;
  Size:TPoint2;
  Angle:real;
end;

TAnimInfo=record
  AnimParts:array of TAnimPart;
  AnimImage:string;
end;

TAnimArrayInfo = array of TAnimInfo;

procedure SaveAnimInfo(FileName:string;AnimInfo:TAnimArrayInfo);
function LoadAnimInfo(FileName:string):TAnimArrayInfo;

implementation

function LoadAnimInfo(FileName:string):TAnimArrayInfo;
var
  FileStream: TFileStream;
begin
  if not FileExists(FileName) then exit;

  FileStream:=TFileStream.Create(FileName,fmOpenRead);

  FileStream.ReadBuffer(Result,FileStream.Size);
  FileStream.Free;
end;

procedure SaveAnimInfo(FileName:string;AnimInfo:TAnimArrayInfo);
var
  FileStream: TFileStream;
  PAnimInfo:^TAnimArrayInfo;
begin
  New(PAnimInfo);
  PAnimInfo^:=AnimInfo;
  FileStream:=TFileStream.Create(FileName,fmCreate);
  FileStream.WriteBuffer(Pointer(AnimInfo),SizeOf(AnimInfo));
  PAnimInfo:=nil;
  FileStream.Free;
end;

end.
